﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace Aletfa.LightManager.Effects
{
    public sealed class CustomStatusEffect : IGameEffect
    {
        public AlterEffectType Type { get; set; }

        public string Description { get; set; }

        /// <inheritdoc />
        public string Perform(Unit target)
        {
            switch (this.Type)
            {
                case AlterEffectType.Add:
                    target.CustomStatus.Add(this.Description);
                    return string.Format("{0} prende \"{1}\"", target.Name, this.Description);
                case AlterEffectType.Remove:
                    target.CustomStatus.Remove(this.Description);
                    return string.Format("{0} perde \"{1}\"", target.Name, this.Description);
                case AlterEffectType.Reset:
                    target.CustomStatus.Clear();
                    return string.Format("{0} prende tutti gli status", target.Name);
            }
            throw new NotImplementedException();
        }

        public string Undo(Unit target)
        {
            switch (this.Type)
            {
                case AlterEffectType.Add:
                    target.CustomStatus.Remove(this.Description);
                    return string.Format("{0} perde \"{1}\"", target.Name, this.Description);
                case AlterEffectType.Remove:
                    target.CustomStatus.Add(this.Description);
                    return string.Format("{0} prende \"{1}\"", target.Name, this.Description);
                case AlterEffectType.Reset:
                    throw new NotImplementedException();
            }
            throw new NotImplementedException();
        }

        public bool IsTemporary { get; set; }

        /// <inheritdoc />
        public bool IsOneShot
        {
            get { return true; }
        }
    }
}
